// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import 'element-ui/lib/theme-chalk/index.css'
import VueAxios from 'vue-axios'
import fastClick from 'fastclick'
import ElementUI from 'element-ui'
import Vuex from 'vuex'

Vue.config.productionTip = false

/* 使用axios获取数据 */
Vue.use(VueAxios, axios)

/* 使用vuex来共享组件状态 */
Vue.use(Vuex)
// axios.defaults.withCredentials = true  //设置cookie
// axios.defaults.baseURL = 'https://api.cdyouyuejia.net/api'
axios.defaults.headers.post['YYJ-APP-NAME'] = 'YYJ_ERP'
axios.defaults.headers.get['YYJ-APP-NAME'] = 'YYJ_ERP'
axios.defaults.headers.delete['YYJ-APP-NAME'] = 'YYJ_ERP'
axios.defaults.headers.put['YYJ-APP-NAME'] = 'YYJ_ERP'
// axios.defaults.headers.put['token'] = sessionStorage.getItem('token')

// 使用elementUi样式
Vue.use(ElementUI)
/* fastclick,解决移动端300ms延迟 */
if ('addEventListener' in document) {
  document.addEventListener('DOMContentLoaded', function() {
    fastClick.attach(document.body)
  }, false)
}
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})

